package com.zqh.myfmmall.controller;


import com.fasterxml.jackson.core.JsonProcessingException;
import com.zqh.myfmmall.result.Result;
import com.zqh.myfmmall.service.ProductCommentsService;
import com.zqh.myfmmall.vo.ProductCommentsVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import javax.annotation.Resource;
import java.util.List;

/**
 * 商品评价 (ProductComments)表控制层
 *
 * @author KONO 曾淇杭哒！
 * @since 2022-01-20 20:53:00
 */
@RestController
@RequestMapping("productComments")
@ApiIgnore
public class ProductCommentsController {
    @Resource
    private ProductCommentsService productCommentsService;

    @GetMapping("detail/{pid}")
    public Result detail(@PathVariable("pid") String pid) throws JsonProcessingException {
        List<ProductCommentsVO> productCommentsVOS = productCommentsService.getByProductId(pid);
        return Result.success(productCommentsVOS);
    }
}

